const express = require('express')
const rolesRouter = express.Router();
const DB = require("./../db/config")

module.exports = rolesRouter;

rolesRouter.route('/roles/getAll')
.get(function(req, res){
  // console.log("请求角色")
  let sql = 'select * from roles;'
  let cb = (err, data)=>{
    if(!err){
      res.json({code:0, data, msg:'查询角色成功'})
    }else{
      res.json({code:0, msg:'查询角色失败'})
    }
  };
  DB.connect(sql, [], cb);
});

